package webServiceClient;

import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import VWorld.Avatar;
import VWorld.Height;
import VWorld.Humor;
import VWorld.Message;
import VWorld.Sex;

import webService.VWorldWebservice;


public class ClientWS {
Service service;

public void test() {
try { // Call Web Service Operation	
	URL wsdlLocation = new URL(
	"http://localhost:8080/VWorld/VWorldWebservice");
	QName serviceQName = new QName("http://VWorldService/", "VWorldService");

	service = Service.create(wsdlLocation,
		serviceQName);

	VWorldWebservice myService = 	service.getPort(VWorldWebservice.class);

	Avatar arg0 = new Avatar(1, Height.GEANT, Humor.COWS, Sex.MAN, "test", "test", "test", false, 0, false);
	Message[] messages = myService.getUnreadMessages(arg0);
	System.out.println(messages.length+" unread messages ----");
	for(Message m : messages){
		System.out.println("- From "+m.from.name+" :"+m.message);
	}
	
} catch (Exception ex) {
	// TODO handle custom exceptions here
}
	// TODO code application logic here
}

public static void main(String[] args) {

	ClientWS client = new ClientWS();

	client.test();
}

}